@import './mixins.scss';
@import './keyframes.scss';
@import './fileInfo.scss';
@import './markdown.scss';

:root {
  --scrollbar-width: 4px;
}

* {
  margin: 0;
  padding: 0;

  &:focus {
    outline: none;
  }
}

html {
  overflow: auto;
}

html,
body {
  width: 100%;
  height: 100%;
  font-size: 14px;
}

body {
  user-select: none;
  font-family: 'Roboto', sans-serif;
  -webkit-tap-highlight-color: transparent;
  background-color: #9999ff;
  background-color: var(--primary-color);
  color: #252525;
  color: var(--secondary-text-color);

  &.no-animation * {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
  }

  &:not(.loading).title-loading {
    &.title-loading-hide {
      &::after {
        background-image: none;
        transform: translateX(-50%) translateY(-100%) scale3d(0.5, 0.5, 1);
        opacity: 0;
        animation: hide-loader 100ms ease-in 1;
      }
    }

    &::after {
      content: '';
      background-color: #3333ff;
      background-color: var(--primary-color);
      border-radius: 50%;
      position: fixed;
      height: 40px;
      width: 40px;
      top: 6px;
      left: 50%;
      transform: translateX(-50%);
      background-image: url(https://localhost/__cdvfile_assets__/www/res/tail-spin.svg);
      background-repeat: no-repeat;
      background-position: center;
      background-size: 30px;
      box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2);
      box-shadow: 0 0 4px 0 var(--box-shadow-color);
      border: solid 1px transparent;
      border: solid 1px var(--popup-border-color);
      animation: appear 100ms ease-out 1;
      box-sizing: border-box;
      z-index: 999;
    }
  }

  .main {
    position: relative;
  }
}

a {
  color: #615efd;
  color: var(--link-text-color);
}

.open-file-list {
  position: relative;
  height: 30px;
  width: 100%;
  background-color: #9999ff;
  background-color: var(--primary-color);
  overflow-x: auto !important;
  overflow-y: hidden !important;
  display: flex;
  flex-direction: row !important;
  color: white;
  color: var(--primary-text-color);
  z-index: 5;

  li.tile {
    $width: 120px;
    height: 100%;
    overflow: hidden;
    font-size: 0.8em;
    align-items: center;
    margin: 0;
    padding: 0;
    color: inherit;
    min-width: $width;
    min-width: var(--file-tab-width);
    max-width: $width;
    max-width: var(--file-tab-width);

    .text {
      display: inline-block;
      white-space: nowrap;
      max-width: $width;
      max-width: var(--file-tab-width);
      overflow: hidden;
      text-overflow: ellipsis;
      margin: 0;
      padding: 0;
      color: inherit;
    }

    &.notice {
      &::before {
        content: '•';
        color: #ffda0c;
        font-size: 1.5em;
        margin-left: 2.5px;
        text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
      }
    }

    &.active {
      border-top: solid 2px gold;
      background-color: rgba(0, 0, 0, 0.2);
    }

    .file,
    .icon {
      height: 24px;
      width: 24px;
      font-size: 1em;
      background-size: 22px;
      background-position: center;
      color: inherit;
    }
  }
}

a.icon {
  pointer-events: all !important;
  color: white;

  &:focus,
  &:active {
    border: none;
    outline: none;
  }
}

.no-scroll {
  &::-webkit-scrollbar {
    width: 0px;
    height: 0px;
  }
}

.list,
.prompt,
.scroll {
  &::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.333);
    background: var(--scrollbar-color);
    border-radius: calc(var(--scrollbar-width) / 2);
  }
}

.icon {
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  text-decoration: none;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-position: center;
  background-size: 24px;
  background-repeat: no-repeat;

  &.hidden {
    display: none !important;
  }

  &.color {
    display: flex;

    &::before {
      content: '';
      height: 16px;
      width: 16px;
      border: solid 1px #a90000;
      border: solid 1px var(--active-color);
      background-color: currentColor;
      color: inherit !important;
    }

    &.dark {
      color: #252525;
    }

    &.light {
      color: #ffffff;
    }
  }

  &.notice {
    @include icon-badge;
  }

  &.angularjs::before {
    content: '\e92f';
    color: #dd0031;
  }

  &.html::before {
    content: '\e939';
    color: #e34f26;
  }

  &.disabled {
    opacity: 0.6;
    pointer-events: none;
  }

  &.dull {
    opacity: 0.6;
  }

  &:focus {
    border: rgba(0, 0, 0, 0.1);
  }

  &:not(.floating):active {
    transition: all 100ms ease;
    background-color: rgba(0, 0, 0, 0.2) !important;
    background-color: var(--active-icon-color) !important;
  }

  &.active {
    background-color: rgba(0, 0, 0, 0.2) !important;
    background-color: var(--active-icon-color) !important;
  }

  &.foxdebug {
    background-image: url(https://localhost/__cdvfile_assets__/www/res/logo/favicon.ico);
  }

  &.no-icon {
    max-width: 5px;
    margin-right: 5px;
    border-radius: 0;
  }

  &.letters::before {
    content: attr(data-letters);
    text-transform: uppercase;
    font-size: 0.6em;
    font-weight: bolder;
  }

  &.verified {
    background-image: url(https://localhost/__cdvfile_assets__/www/res/verified.svg);
  }
}

.mask {
  position: fixed;
  left: 0;
  top: 0;
  display: block;
  height: 100vh;
  width: 100vw;
  background-color: black;
  opacity: 0;
}

footer {

  &.button-container,
  .button-container {
    overflow-x: auto;

    .section {
      max-width: 100%;
      min-width: 100%;

      .icon.active {
        @include active-icon;
      }
    }

    background-color: #9999ff;
    background-color: var(--primary-color);
    color: white;
    color: var(--primary-text-color);
  }
}

.section,
.button-container {
  display: flex;
  min-height: 40px;
  background-color: inherit;
  color: inherit;
  user-select: none;
  width: 100%;

  &.primary {
    button {
      color: white !important;
      color: var(--button-text-color) !important;
      background-color: #39f !important;
      background-color: var(--button-background-color) !important;
      box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
      box-shadow: 0 0 4px var(--box-shadow-color);
      border-radius: 4px;

      &:active {
        background-color: #2c8ef0 !important;
        background-color: var(--button-active-color) !important;
        box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
        box-shadow: inset 0 0 2px var(--box-shadow-color);
      }
    }
  }

  &.disabled {
    pointer-events: none;

    .icon,
    input,
    button {
      opacity: 0.6;
    }
  }

  >button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    text-transform: uppercase;
    background-color: inherit;
    color: inherit;

    * {
      pointer-events: none;
    }

    &.disabled {
      pointer-events: none;
      opacity: 0.6;
    }

    &:active {
      transition: all 100ms ease;
      box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
      box-shadow: inset 0 0 4px var(--box-shadow-color);
    }

    &:disabled {
      opacity: 0.6;
    }
  }

  textarea,
  input {
    flex: 2;
    height: auto;
    color: inherit;
    border-bottom: 1px solid currentColor;
    margin: 5px;
    background-color: inherit;

    &::placeholder {
      color: rgba(255, 255, 255, 0.6);
    }
  }

  .icon {
    color: inherit;
    font-size: 1.3em;
  }

  .search,
  .save {
    font-size: 1em;
  }
}

input {
  height: 40px;
  outline: none;
  border: none;
  background-color: inherit;
  border-bottom: solid 1px #252525;
  border-bottom: solid 1px var(--secondary-text-color);
  padding: 0;
  box-sizing: border-box;
  color: #252525;
  color: var(--secondary-text-color);
  caret-color: currentColor;
  text-indent: 10px;

  &:focus {
    border-bottom-color: #a90000 !important;
    border-bottom-color: var(--active-color) !important;
  }
}

input,
textarea {
  &::placeholder {
    color: inherit;
    opacity: 0.8;
  }
}

.search-status {
  flex: 1;
  display: flex;
  color: white;
  color: var(--primary-text-color);
  align-items: center;
  justify-content: center;

  span:not(:nth-child(2)) {
    margin: 0 5px;
    color: white;
    color: var(--primary-text-color);
  }
}

.cursor {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  border-radius: 50%;
  background-color: white;
  background-color: var(--primary-text-color);
  border: solid 1px #666;
  box-sizing: border-box;
  transform-origin: left top;
  z-index: 4;
  pointer-events: none;

  &[data-size='60'] {
    width: 60px;
    height: 60px;
  }

  &[data-size='30'] {
    width: 30px;
    height: 30px;
  }

  &[data-size='20'] {
    width: 20px;
    height: 20px;
  }

  &.end {
    border-radius: 0% 50% 50% 50%;
  }

  &.start {
    border-radius: 50% 0 50% 50%;
  }

  &.single {
    transform: rotate(45deg);
    border-radius: 0 50% 50% 50%;
  }
}

.cursor-menu {
  position: absolute;
  top: 0;
  left: 0;
  height: 40px;
  background-color: #ffffff;
  background-color: var(--secondary-color);
  display: flex;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 8px var(--box-shadow-color);
  border: none;
  border: solid 1px var(--popup-border-color);
  color: #252525;
  color: var(--secondary-text-color);
  transform-origin: left center;
  z-index: 4;

  >span,
  >div {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.9em;
    min-width: 50px;
    color: inherit;
    user-select: none;
    white-space: nowrap;

    &.disabled {
      opacity: 0.6;
      pointer-events: none;
    }
  }
}

.file {
  display: flex;
  align-items: center;
  justify-content: center;
  background-repeat: no-repeat;
  background-position: 6px center;
  background-size: 18px;
  width: 30px;
  height: 30px;
}

.hr {
  display: flex;
  align-items: center;
  margin: auto auto 15px auto;

  &::after,
  &::before {
    content: '';
    height: 1px;
    width: 60px;
    background-color: #252525;
    background-color: var(--secondary-text-color);
    margin: auto 15px;
    opacity: 0.5;
  }
}

.d-none {
  display: none !important;
}

.floating.icon {
  position: fixed;
  height: 50px;
  width: 50px;
  font-size: 1.6rem;
  border: 1px solid;
  background-color: #9999ff;
  background-color: var(--primary-color);
  top: 10px;
  right: 10px;
  opacity: 0.2;
  box-sizing: border-box;
  color: white;
  color: var(--primary-text-color);
  transition: all 300ms ease;
  box-shadow: -5px 5px 20px 0px rgba(0, 0, 0, 0.5);

  &:active {
    transition: all 100ms ease;
    box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.5);
  }

  &.hide {
    opacity: 0 !important;
  }
}

button {
  &.floating.icon {
    z-index: 1;
    opacity: 1;

    &:disabled {
      opacity: 0.2;
    }
  }
}

#social-links {
  position: relative;
  height: 60px;
  font-size: 1.2em;
  width: 100%;
  text-align: center;

  &::after {
    display: block;
    width: 100%;
    content: attr(title);
    text-align: center;
    font-size: 0.5em;
    text-transform: none;
  }

  a {
    display: inline-flex;
    min-height: 40px;
    min-width: 40px;
    text-shadow: 0 0 1px white;

    &.github {
      color: black;
    }
  }
}

#header-toggler {
  display: none;
  top: 10px;
  right: 10px;
  z-index: 1;
  height: 40px;
  width: 40px;
}

#sidebar-toggler {
  display: none;
  top: 10px;
  left: 10px;
  z-index: 1;
  height: 40px;
  width: 40px;
}

#quicktools-toggler {
  top: auto;
  bottom: 10px;
  right: 10px;
  z-index: 1;
}

.sake {
  animation: sake 3s ease-out infinite;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.link {
  text-decoration: underline;
}

.w-resize {
  cursor: w-resize;
}

.note {
  margin: 20px 0;

  .note-title {
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    text-transform: uppercase;

    .icon {
      margin: 0 10px;
    }
  }

  p {
    padding: 10px;
    box-sizing: border-box;
    opacity: 0.8;
    font-size: 0.9rem;
  }
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

.notification-toast-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;

    .notification-toast {
        padding: 12px;
        border-radius: 6px;
        background: var(--secondary-color);
        min-width: 300px;
        max-width: 400px;
        display: flex;
        gap: 12px;
        align-items: flex-start;
        box-shadow: 0 4px 12px var(--box-shadow-color);
        animation: toastSlideIn 0.3s ease-out;
        transition: all 0.3s ease;
        border: 1px solid var(--border-color);
        word-break: break-word;
        white-space: normal;

        &.hiding {
            transform: translateX(120%);
            opacity: 0;
        }

        .close-icon {
            cursor: pointer;
            font-size: 14px;
            color: var(--secondary-text-color);
            margin-left: auto;

            &:hover {
                color: var(--button-background-color);
            }
        }

        .notification-icon {
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            color: var(--primary-text-color);
        }

        .notification-content {
            flex: 1;
            min-width: 0;

            .notification-title {
                font-size: 13px;
                font-weight: 500;
                margin-bottom: 4px;
                color: var(--primary-text-color);
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

            .notification-message {
                font-size: 12px;
                color: var(--secondary-text-color);
                line-height: 1.4;
                overflow-wrap: break-word;
                hyphens: auto;
            }
        }

        &.success {
            .notification-icon {
                color: #48c158;
            }
        }

        &.warning {
            .notification-icon {
                color: var(--danger-text-color);
            }
        }

        &.error {
            .notification-icon {
                color: var(--error-text-color);
            }
        }

        &.info {
            .notification-icon {
                color: var(--primary-text-color);
            }
        }
    }

    @media (max-width: 768px) {
        .notification-toast {
            min-width: auto;
            max-width: calc(100vw - 40px);
        }
    }
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
